package com.yu.waterstation.system.modules.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yu.waterstation.common.entity.system.SysUser;
import com.yu.waterstation.common.entity.system.form.SysUserVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @since  2020-11-29 18:17:30
 */
public interface SysUserMapper extends BaseMapper<SysUser> {

    @Select("select sys_user.id, sys_user.`username`, sys_user.`status`, sys_user.`status` ,\n" +
            " sys_role.`id` as roleId, sys_role.`name` as roleName from sys_user  \n" +
            " left join sys_role  on  sys_user.`role_id` = sys_role.`id`; ")
    List<SysUserVo> getAllUserVOs();

    @Select("select college_id from sys_user where username = #{username}; ")
    Integer selectCollegeIdByUsername(@Param("username") String username);
}
